import { http } from '@/utils/http'
import type { GoodsSku } from '../goods.d'
/** 添加商品收藏 */
export const addCollect = (goodsId: number) => {
  return http<boolean>({
    url: '/goods/collect/add',
    method: 'GET',
    query: { goodsId },
  })
}
/** 删除单个收藏 */
export const deleteCollect = (id: number) => {
  return http<boolean>({
    url: '/goods/collect/delete',
    method: 'DELETE',
    query: { id },
  })
}

/** 批量删除收藏 */
export const deleteCollectBatch = (ids: number[]) => {
  return http<boolean>({
    url: '/goods/collect/delete/batch',
    method: 'DELETE',
    query: { ids },
  })
}

/** 检查商品收藏状态 */
export const checkCollectStatus = (id: number) => {
  return http<boolean>({
    url: `/goods/collect/check/sku/${id}`,
    method: 'GET',
  })
}

/** 获取用户收藏商品列表 */
export const getCollections = (params: { current?: number; size?: number }) => {
  return http<PageResult<GoodsSku>>({
    url: '/goods/collect/list',
    method: 'GET',
    query: params,
  })
}
